PLATFORM:=$(shell uname)
FILE_LOCATION:=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
ifneq ($(PLATFORM),Linux)
FILE_LOCATION_ASSIST:=$(subst /, ,$(FILE_LOCATION))
ifeq ($(word 1,$(FILE_LOCATION_ASSIST)),cygdrive)
FILE_LOCATION:=$(patsubst /cygdrive/$(word 2,$(FILE_LOCATION_ASSIST))%,$(word 2,$(FILE_LOCATION_ASSIST)):%,$(FILE_LOCATION))
endif
endif

.PHONY:$(MAKECMDGOALS) hold
hold:;
$(MAKECMDGOALS):hold
	@if [ -e $(FILE_LOCATION)$@ ];then \
		if [ ! -e $(FILE_LOCATION)middle.mk ];then touch $(FILE_LOCATION)middle.mk;echo middle.mk>$(FILE_LOCATION).gitignore;fi; \
		echo "#" > $(FILE_LOCATION)middle.mk; \
		echo TARGET99:="$$"\(call formDll,"$$"\(THEBUILDER_REPO_LOCATION\)../output/$@\) >> $(FILE_LOCATION)middle.mk; \
		echo TARGET99_FLAKE1:="$$"\(call formObj,"$$"\(THEBUILDER_REPO_LOCATION\)../output/obj/$@\) >> $(FILE_LOCATION)middle.mk; \
		echo TARGET99_FLAKE1_source:=$(FILE_LOCATION)$@/$@.cpp >> $(FILE_LOCATION)middle.mk; \
		echo TARGET99_FLAKE1_header:="$$"\(call getTheMM,hpp,"$$"\(TARGET99_FLAKE1_source\),"$$"\(PATH_INCLUDE\)\) >> $(FILE_LOCATION)middle.mk; \
		echo TARGET99_FLAKE1_inline:="$$"\(call getTheMM,inl,"$$"\(TARGET99_FLAKE1_source\),"$$"\(PATH_INCLUDE\)\) >> $(FILE_LOCATION)middle.mk; \
		echo ifeq \("$$"\(PLATFORM\),Linux\) >> $(FILE_LOCATION)middle.mk; \
		echo TARGET99_FLAKE1_library:=$(shell cat $(FILE_LOCATION)$@/liblist_just4Linux.txt) >> $(FILE_LOCATION)middle.mk; \
		echo endif >> $(FILE_LOCATION)middle.mk; \
		echo TARGET99_FLAKEs:=TARGET99_FLAKE1 >> $(FILE_LOCATION)middle.mk; \
		echo TARGET99_FLAKEs_VARs:="$$"\(TARGET99_FLAKE1\) >> $(FILE_LOCATION)middle.mk; \
		echo ifeq \("$$"\(PLATFORM\),Linux\) >> $(FILE_LOCATION)middle.mk; \
		echo TARGET99_FLAKEs_LIBs:="$$"\(call get_fullpath,"$$"\(TARGET99_FLAKE1_library\),"$$"\(PATH_LIB\)\) >> $(FILE_LOCATION)middle.mk; \
		echo endif >> $(FILE_LOCATION)middle.mk; \
		echo TARGET99_TYPE:="$$"\(call getType,"$$"\(TARGET99\)\) >> $(FILE_LOCATION)middle.mk; \
	fi;
	@cp $(FILE_LOCATION)../theBuilder/config_local.mk $(FILE_LOCATION)../theBuilder/config_local_origin.mk;
	@cat $(FILE_LOCATION)middle.mk >> $(FILE_LOCATION)../theBuilder/config_local.mk;
	@if [ -e $(FILE_LOCATION)$@/appendpath_include.txt ];then \
		cp $(FILE_LOCATION)../theBuilder/path_include.txt $(FILE_LOCATION)../theBuilder/path_include_origin.txt; \
		cat $(FILE_LOCATION)$@/appendpath_include.txt >> $(FILE_LOCATION)../theBuilder/path_include.txt; \
	fi;
	@if [ -e $(FILE_LOCATION)$@/appendpath_lib.txt ];then \
		cp $(FILE_LOCATION)../theBuilder/path_lib.txt $(FILE_LOCATION)../theBuilder/path_lib_origin.txt; \
		cat $(FILE_LOCATION)$@/appendpath_lib.txt >> $(FILE_LOCATION)../theBuilder/path_lib.txt; \
	fi;
ifeq ($(PLATFORM),Linux)
	@-bash $(FILE_LOCATION)../theBuilder/theBuilder/xmake.sh -s 99;
else
	@-cmd /C call $(FILE_LOCATION)../theBuilder/theBuilder/xmake.bat -s 99;
endif
	@mv $(FILE_LOCATION)../theBuilder/config_local_origin.mk $(FILE_LOCATION)../theBuilder/config_local.mk;
	@if [ -e $(FILE_LOCATION)$@/appendpath_include.txt ];then \
		mv $(FILE_LOCATION)../theBuilder/path_include_origin.txt $(FILE_LOCATION)../theBuilder/path_include.txt; \
	fi;
	@if [ -e $(FILE_LOCATION)$@/appendpath_lib.txt ];then \
		mv $(FILE_LOCATION)../theBuilder/path_lib_origin.txt $(FILE_LOCATION)../theBuilder/path_lib.txt; \
	fi;
	@rm -f $(FILE_LOCATION)../theBuilder/output/$@.exp $(FILE_LOCATION)../theBuilder/output/$@.lib;
